home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 April / EnigmA AMIGA RUN 17 (1997)(G.R. Edizioni)(IT)[!][issue 1997-04][EAR-CD].iso / EARCD / comm / tcp / Tallahassee.lha / Tallahassee / Bin / postnews < prev    next >
Text File  |  1996-11-21  |  4KB  |  165 lines

  1. /*
  2. ** Postnews Replacement Script
  3. ** GRn Can Now Post News :-)
  4. */
  5. Parse arg result
  6. say result
  7. a = 1
  8. art = word(result,1)
  9. say art
  10. art2 = word(result,3)
  11. alreadyinsertedfile = "FALSE"
  12. org = "The Martin Hunt Fan Club"
  13. if open(org,"env:organization","R") then
  14. do
  15.    organisation = readln(org)
  16.    call close(org)
  17. end
  18. pub.1 = "Hyde Park"
  19. pub.2 = "Mutley Tavern"
  20. pub.3 = "Fortescue"
  21. pub.4 = "Ship"
  22. pub.5 = "Cider Press"
  23. pub.6 = "Distillery"
  24. pub.7 = "George"
  25. pub.8 = "Kings Head"
  26. pub.9 = "PUSU Bar"
  27. pub.10 = "Shitzy's"
  28.  
  29. time = time()
  30. parse var time o_hours ":" o_minutes ":" o_seconds
  31. seed = O_hours*O_minutes*O_seconds
  32. rand = Random(1,10,seed)
  33. organisation = "Out of my head in the "||pub.rand
  34.  
  35. if open(org,"env:user","R") then
  36. do
  37.    user = readln(org)
  38.    call close(org)
  39. end
  40. if open(hos,"env:host","R") then
  41. do
  42.    host = readln(hos)
  43.    call close(hos)
  44. end
  45. if open(rln,"env:realname","R") then
  46. do
  47.    realname = readln(rln)
  48.    call close(rln)
  49. end
  50.  
  51. if art2 = "" then
  52. do
  53.   call open(file,art,"A")
  54.   call seek(file,0,"B")
  55.   a = 1
  56.   newsgroup = readln(file)
  57.   line.1 = newsgroup
  58.   a = 3
  59.   line.3 = "Organization: "||organisation
  60.   line.2 = "From: "||user||"@"||host||" ("||realname||")"
  61.   do until eof(file)
  62.     a = a + 1
  63.     line.a = readln(file)
  64.     if compress(line.a) == "--" then
  65.     do
  66.       call signature()
  67.       lev = 1
  68.     end
  69.     if lev = 1 then leave
  70.   end
  71.   call close(file)
  72.   call open(file,art,"W")
  73.   call seek(file,0,"B")
  74.   do i = 1 to a
  75.      call writeln(file,line.i)
  76.   end
  77.   call close(file)
  78. end
  79. if art2 ~="" then
  80. do
  81.   call open(file,art,"A")
  82.   call seek(file,0,"B")
  83.   newsgroup = readln(file)
  84.   line.1 = newsgroup
  85.   a = 2
  86.   sig = 0
  87.   do while ~eof(file) & ~Sig
  88.     a = a + 1
  89.     if alreadyinsertedfile == "FALSE" then call insertfile2()
  90.     line.a = readln(file)
  91.     say line.a
  92.     if compress(line.a) == "--" then call signature()
  93.     if upper(word(line.a,1)) == "FROM:" then a = a - 1
  94.   end
  95.   call close(file)
  96.   n = 1
  97.   quitflag = 0
  98.   do until quitflag
  99.      filename = "t:grn-file."||n
  100.      if ~exists(filename) then quitflag = 1
  101.      n = n + 1
  102.   end
  103.   art = filename
  104.   call open(file,art,"W")
  105.   call seek(file,0,"B")
  106.   line.2 = "Organization: "||organisation
  107.   line.3 = "From: "||user||"@"||host||" ("||realname||")"
  108.   do i = 1 to a
  109.      call writeln(file,line.i)
  110.   end
  111.   call close(file)
  112. end
  113.  
  114. newsno = 0
  115. result1 = open(batchnews,"uuspool:newsno","A")
  116. if ~result1 then result2 = open(batchnews,"uuspool:newsno","W")
  117. call seek(batchnews,0,"B")
  118. if result1 then newsno=readln(batchnews)
  119. newsno = newsno + 1
  120. call seek(batchnews,0,"B")
  121. call writeln(batchnews,newsno)
  122. call close(batchnews)
  123.  
  124. newnewsfile = "uuspool:news."||newsno
  125. copycmd = "copy "||art||" to "||newnewsfile
  126. address command copycmd
  127. result1 = open(batchnews,"uuspool:newsout","A")
  128. if ~result1 then open(batchnews,"uuspool:newsout","W")
  129. call seek(batchnews,0,"E")
  130. call writeln(batchnews,newnewsfile)
  131. call close(batchnews)
  132.  
  133. exit
  134.  
  135. insertfile2:
  136.   call open(file2,art2,"R")
  137.   do while ~eof(file2)
  138.     a = a + 1
  139.     line.a = readln(file2)
  140.     if word(line.a,1) == "X-NewsSoftware:" then line.a = "X-NewsSoftware: GRn 2.1 19/2/94 (PostNews Fix 31/3/95 Martin Hunt)"
  141.   end
  142.   alreadyinsertedfile = "TRUE"
  143.   call close(file2)
  144. RETURN
  145.  
  146. Signature:
  147. parse var newsgroup title ": " name.1 "." name.2 "." name.3 "." name.4 "." name.5 "." name.6 "." name.7 "." name.8 "." name.9 "." name.10
  148. nameno = 1
  149. sigfile = "uunews:"
  150. do while name.nameno ~== ""
  151.   sigfile = sigfile || name.nameno ||"/"
  152.   nameno = nameno + 1
  153. end
  154. sigfile = sigfile ||".sig"
  155. if open(sig,sigfile,"R") then
  156. do
  157.   do until eof(sig)
  158.     a = a + 1
  159.     line.a = readln(sig)
  160.   end
  161.   call close(sig)
  162.   sig = 1
  163. end
  164. return
  165.